import axios from './http'


/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const loginApi =  (data) => {
    return  axios.post('/user/login',data);
}

/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const registerApi =  (data) => {
    console.log("register: "+ axios.defaults.baseURL)
    return  axios.post('/user/register',data);
}

/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const userInfoApi =  (data) => {
    console.log("getUserInfo: "+ axios.defaults.baseURL)
        return  axios.post('/user/getUserInfo',data);
}


/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileDownLoadApi =  (data) => {
    return  axios.post('/file/download',data);
}

/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileDeleteApi =  (data) => {
    return  axios.post('/file/delete',data);
}

/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileRenameApi =  (data) => {
    return  axios.post('/file/changeFileName',data);
}

/**
 * 批量上传
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileBatchUploadApi =  (data) => {
    return  axios.post('/file/batchUpload',data);
}

/**
 * 批量下载
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileBatchUDownloadApi =  (data) => {
    return  axios.post('/file/batchDownload',data);
}

/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const loginOutApi =  (data) => {
    return  axios.post('/batchUpload',data);
}


/**
 *
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const fileApi = (data) =>{
    return axios.post('/fileUpload',data)
}


/**
 * 文件的创建
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const newDirApi =  (data) => {
    return  axios.post('/file/newDir',data);
}


/**
 * 获取文件操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getFileApi =  (data) => {
    return  axios.get('/file/getFile'+data);
}
/**
 * 获取文件操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const postFileApi =  (data) => {
    return  axios.post('/file/getFile',data);
}

/**
 * 通过文件类型获取操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const postFileByTypeApi =  (data) => {
    return  axios.post('/file/getAllFileType',data);
}



/**
 * 删除文件操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const delFileApi =  (data) => {
    return  axios.post('/file/delFile',data);
}



/**
 * 更新用户文件名称
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const changeFileNameApi =  (data) => {
    return  axios.post('/file/changeFileName',data);
}



/**
 * 下载文件操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const downloadFileApi =  (data) => {
    return  axios.get('/file/downloadFile',data);
}

/**
 * 文件预览功能
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const lookImageApi =  (data) => {
    return  axios.get('/file/lookImage',data);
}


/**
 * 获取到对应的type
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getAllFileTypeApi =  (data) => {
    return  axios.get('/file/getAllFileType',data);
}


/**
 * 文件恢复操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const refreshApi =  (data) => {
    return  axios.post('/file/refresh',data);
}

/**
 * 刷新操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const searchApi =  (data) => {
    return  axios.post('/file/search',data);
}


/**
 *  通过文件ID获取文件操作
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const searchSingleApi =  (data) => {
    return  axios.post('/file/singleFile',data);
}


/**
 * 指令处理接口
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const commandHandle =  (data) => {
    return  axios.post('/intelligence/input',data);
}

/**
 * 获取在线人数
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getInlineNum =  (data) => {
    return  axios.post('/user/online',data);
}

